package com.szxb.facebus.util.toast;


import android.os.Handler;
import android.os.Message;

import com.szxb.facebus.util.basics.Utils;

/**
 * 作者：Tangren on 2018-12-28
 * 包名：com.szxb.facebus.util.toast
 * 邮箱：996489865@qq.com
 * TODO:安全的
 */
public class SalfHanlderWarpper extends Handler {
    private Handler handler;

    public SalfHanlderWarpper(Handler handler) {
        this.handler = handler;
    }

    @Override
    public void dispatchMessage(Message msg) {
        try {
            super.dispatchMessage(msg);
        } catch (Exception e) {
            System.out.println(Utils.getExectionStr(e));
        }

    }

    @Override
    public void handleMessage(Message msg) {
        if (handler != null) {
            handler.handleMessage(msg);
        }
    }
}
